<include file="public/layout" />
<!--物流配置 css -start-->
<style>
    ul.group-list {
        width: 96%;min-width: 1000px; margin: auto 5px;list-style: disc outside none;
    }
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
    .row .table-bordered td .btn,.row .table-bordered td img{
        vertical-align: middle;
    }
    .row .table-bordered td{
      padding: 8px;
      line-height: 1.42857143;
    }
    .table-bordered{
      width: 100%
    }
    .table-bordered tr td{
      border: 1px solid #f4f4f4;
    }
    .btn-success {
        color: #fff;
        background-color: #449d44;
        border-color: #398439 solid 1px;
    }
    .btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}
.col-xs-8 {
    width: 66.66666667%;
}
.col-xs-4 {
    width: 33.33333333%;
}
.col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
    float: left;
}
.row .tab-pane h4{
  padding: 10px 0;
}
.row .tab-pane h4 input{
  vertical-align: middle;
} 
.table-striped>tbody>tr:nth-of-type(odd) {
    background-color: #f9f9f9;
}
.ncap-form-default .title{
  border-bottom: 0
}
.ncap-form-default dl.row, .ncap-form-all dd.opt{
    /*border-color: #F0F0F0;*/
    border: none;
}
.ncap-form-default dl.row:hover, .ncap-form-all dd.opt:hover{
    border: none;
    box-shadow: inherit;
}
</style>
<!--物流配置 css -end-->
<!--以下是在线编辑器 代码 -->
<script type="text/javascript">
    /*
	 * 在线编辑器相 关配置 js 
	 *  参考 地址 http://fex.baidu.com/ueditor/
	 */
    window.UEDITOR_Admin_URL = "/public/plugins/Ueditor/";
    var URL_upload = "{$URL_upload}";
    var URL_fileUp = "{$URL_fileUp}";
    var URL_scrawlUp = "{$URL_scrawlUp}";
    var URL_getRemoteImage = "{$URL_getRemoteImage}";
    var URL_imageManager = "{$URL_imageManager}";
    var URL_imageUp = "{$URL_imageUp}";
    var URL_getMovie = "{$URL_getMovie}";
    var URL_home = "{$URL_home}";
</script>
<script src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">  
  
    var editor;
    $(function () {
        //具体参数配置在  editor_config.js  中
        var options = {
            zIndex: 999,
            initialFrameWidth: "95%", //初化宽度
            initialFrameHeight: 400, //初化高度
            focus: false, //初始化时，是否让编辑器获得焦点true或false
            maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign'
            , //允许的最大字符数 'fullscreen',
            pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
            autoHeightEnabled: true
         /*   autotypeset: {
                mergeEmptyline: true,        //合并空行
                removeClass: true,           //去掉冗余的class
                removeEmptyline: false,      //去掉空行
                textAlign: "left",           //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版
                imageBlockLine: 'center',    //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版
                pasteFilter: false,          //根据规则过滤没事粘贴进来的内容
                clearFontSize: false,        //去掉所有的内嵌字号，使用编辑器默认的字号
                clearFontFamily: false,      //去掉所有的内嵌字体，使用编辑器默认的字体
                removeEmptyNode: false,      //去掉空节点
                                             //可以去掉的标签
                removeTagNames: {"font": 1},
                indent: false,               // 行首缩进
                indentValue: '0em'           //行首缩进的大小
            }*/,
        	toolbars: [
                   ['fullscreen', 'source', '|', 'undo', 'redo',
                       '|', 'bold', 'italic', 'underline', 'fontborder',
                       'strikethrough', 'superscript', 'subscript',
                       'removeformat', 'formatmatch', 'autotypeset',
                       'blockquote', 'pasteplain', '|', 'forecolor',
                       'backcolor', 'insertorderedlist',
                       'insertunorderedlist', 'selectall', 'cleardoc', '|',
                       'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                       'customstyle', 'paragraph', 'fontfamily', 'fontsize',
                       '|', 'directionalityltr', 'directionalityrtl',
                       'indent', '|', 'justifyleft', 'justifycenter',
                       'justifyright', 'justifyjustify', '|', 'touppercase',
                       'tolowercase', '|', 'link', 'unlink', 'anchor', '|',
                       'imagenone', 'imageleft', 'imageright', 'imagecenter',
                       '|', 'insertimage', 'emotion', 'insertvideo',
                       'attachment', 'map', 'gmap', 'insertframe',
                       'insertcode', 'webapp', 'pagebreak', 'template',
                       'background', '|', 'horizontal', 'date', 'time',
                       'spechars', 'wordimage', '|',
                       'inserttable', 'deletetable',
                       'insertparagraphbeforetable', 'insertrow', 'deleterow',
                       'insertcol', 'deletecol', 'mergecells', 'mergeright',
                       'mergedown', 'splittocells', 'splittorows',
                       'splittocols', '|', 'print', 'preview', 'searchreplace']
               ]
        };
        editor = new UE.ui.Editor(options);
        editor.render("goods_content");  //  指定 textarea 的  id 为 goods_content

    }); 
</script>
<!--以上是在线编辑器 代码  end-->
<body style="background-color: #FFF; overflow: auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>商城设置</h3>
                <h5>网站全局内容基本选项设置</h5>
            </div>
            <ul class="tab-base nc-row">
                <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>通用信息</span></a></li>
                <li><a href="javascript:void(0);" data-index='2' class="tab"><span>商品相册</span></a></li>
                <li><a href="javascript:void(0);" data-index='3' class="tab"><span>商品模型</span></a></li>
                <li><a href="javascript:void(0);" data-index='4' class="tab"><span>商品物流</span></a></li>                
            </ul>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span id="explanationZoom" title="收起提示"></span> </div>
        <ul>
            <li>请务必正确填写商品信息</li>
        </ul>
    </div>
    <!--表单数据-->
    <form method="post" id="addEditGoodsForm">

<!--通用信息-->
        <div class="ncap-form-default tab_div_1">
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品货号</label>
                </dt>
                <dd class="opt">
                    <div><input type="text" value="{$goodsInfo.goods_sn}" name="goods_sn" id="goods_sn" class="input-txt"/><input type="button" value="一键填写" id="one_btn" style="border-radius:3px;margin-left:10px;border:0;background:#1BBC9D;color:#fff;padding:3px 5px;cursor:pointer"></div>
                    <span class="err" id="err_goods_sn" style="color:#F00; display:none;"></span>                
                    <p class="notic">如果不填会自动生成</p>
                </dd>
            </dl>    
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.goods_name}" name="goods_name" class="input-txt"/>
                    <span class="err" id="err_goods_name" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="store_name">商品简介</label>
                </dt>
                <dd class="opt">
                    <textarea rows="3" cols="80" name="goods_remark" class="input-txt">{$goodsInfo.goods_remark}</textarea>
                    <span id="err_goods_remark" class="err" style="color:#F00; display:none;"></span>                    
                </dd>
            </dl> 
			
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">SPU</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.spu}" name="spu" class="input-txt"/>
                    <span class="err" id="err_SPU" style="color:#F00; display:none;"></span>
                </dd>
            </dl>    
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">SKU</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.sku}" name="sku" class="input-txt"/>
                    <span class="err" id="err_SKU" style="color:#F00; display:none;"></span>
                </dd>
            </dl> 
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品分类</label>
                </dt>
                <dd class="opt">
                      <select name="cat_id" id="cat_id" onChange="get_category(this.value,'cat_id_2','0');" class="small form-control">
                        <option value="0">请选择商品分类</option>                                      
                             <foreach name="cat_list" item="v" key="k" >                                                                                          
                               <option value="{$v['id']}" <if condition="$v['id'] eq $level_cat['1']">selected="selected"</if> >
                                    {$v['name']}
                               </option>
                             </foreach>
                      </select>
                      <select name="cat_id_2" id="cat_id_2" onChange="get_category(this.value,'cat_id_3','0');" class="small form-control">
                        <option value="0">请选择商品分类</option>
                      </select>
                      <select name="cat_id_3" id="cat_id_3" class="small form-control">
                        <option value="0">请选择商品分类</option>
                      </select>                      
                    <span class="err" id="err_cat_id" style="color:#F00; display:none;"></span>
                </dd>
            </dl>             
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">门店商品分类</label>
                </dt>
                <dd class="opt">
                  <select name="extend_cat_id" id="extend_cat_id" onChange="get_category_admin(this.value,'extend_cat_id_2','0');" class="small form-control">
                    <option value="0">请选择商品分类</option>                                      
                         <foreach name="cat_list_admin" item="v" key="k" >
                           <option value="{$v['id']}" <if condition="$v['id'] eq $level_cat2['1']">selected="selected"</if> >
                                {$v['name']}
                           </option>
                         </foreach>
                  </select>
                  <select name="extend_cat_id_2" id="extend_cat_id_2" onChange="get_category_admin(this.value,'extend_cat_id_3','0');" class="small form-control">
                    <option value="0">请选择商品分类</option>
                  </select>
                  <select name="extend_cat_id_3" id="extend_cat_id_3" class="small form-control">
                    <option value="0">请选择商品分类</option>
                  </select>                   
                    <span class="err" id="err_extend_cat_id" style="color:#F00; display:none;"></span>
                </dd>
            </dl>   
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品品牌</label>
                </dt>
                <dd class="opt">
                <select name="brand_id" id="brand_id"  class="small form-control">
                         <option value="">所有品牌</option>
                        <foreach name="brandList" item="v" key="k" >
                           <option value="{$v['id']}"  <if condition="$v['id'] eq $goodsInfo['brand_id'] ">selected="selected"</if>>
                                {$v['name']}
                           </option>
                         </foreach>
                  </select> 
                </dd>
            </dl>      
			<dl class="row">
                <dt class="tit">
                    <label for="record_no">供应商</label>
                </dt>
                <dd class="opt">
                    <if condition="$suppliersId">
                        <select name="suppliers_id" id="suppliers_id" class="small form-control">
                            <option value="{$suppliersId['suppliers_id']}">{$suppliersId['suppliers_name']}</option>
                        </select>
                            <else/>
                        <select name="suppliers_id" id="suppliers_id" class="small form-control">
                            <option value="0">不指定供应商属于本店商品</option>
                            <foreach name="suppliersList" item="v" key="k" >
                                <option value="{$v['suppliers_id']}"<if condition="$v['suppliers_id'] eq $goodsInfo['suppliers_id']"> selected="selected" </if> >{$v['suppliers_name']}</option>
                            </foreach>
                        </select>
                    </if>
                </dd>
            </dl>  
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">本店售价</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.shop_price}" name="shop_price" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_shop_price" style="color:#F00; display:none;"></span>
                </dd>
            </dl>             
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">市场价</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.market_price}" name="market_price" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_market_price" style="color:#F00; display:none;"></span>
                </dd>
            </dl>   
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">成本价</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.cost_price}" name="cost_price" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_cost_price" style="color:#F00; display:none;"></span>
                </dd>
            </dl>            
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">佣金</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.commission}" name="commission" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_commission" style="color:#F00; display:none;"></span>
                    <p class="notic">用于分销的分成金额</p>
                </dd>
            </dl>       
		<dl class="row">
        <dt class="tit">图片上传</dt>
        <dd class="opt">
          <div class="input-file-show" id="divComUploadContainer">
            <span class="show">
                <a class="nyroModal" rel="gal" href="{$goodsInfo.original_img}">
                    <i class="fa fa-picture-o" onMouseOver="layer.tips('<img src={$goodsInfo.original_img}>',this ,{tips: [1, '#fff']});" onMouseOut="layer.closeAll();"></i>
                </a>
            </span>             
            <span class="type-file-box">            
            <input type="text" id="imagetext" name="original_img" value="{$goodsInfo.original_img}" class="type-file-text">            
            <input type="button" class="type-file-button" onClick="GetUploadify(1,'imagetext','goods','')" value="上传图片"  hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效"/>
            </span>
          </div>
          <div id="thumbnails" class="ncap-thumb-list">
            <h5><i class="fa fa-exclamation-circle"></i> 请上传图片格式文件。</h5>
            <ul>
            </ul>
          </div>
        </dd>
      </dl>            
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品重量</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.weight}" name="weight" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_weight" style="color:#F00; display:none;"></span>
                    <p class="notic"> 务必设置商品重量, 用于技术物流费.</p>
                </dd>
            </dl>  
	  <dl class="row">
        <dt class="tit">
          <label>是否包邮</label>
        </dt>
        <dd class="opt">
          <div class="onoff">
            <label for="is_free_shipping1" class="cb-enable <if condition="$goodsInfo[is_free_shipping] eq 1">selected</if>">是</label>
            <label for="is_free_shipping0" class="cb-disable <if condition="$goodsInfo[is_free_shipping] eq 0">selected</if>">否</label>
            <input id="is_free_shipping1" name="is_free_shipping" value="1" type="radio" <if condition="$goodsInfo[is_free_shipping] eq 1"> checked="checked"</if>>
            <input id="is_free_shipping0" name="is_free_shipping" value="0" type="radio" <if condition="$goodsInfo[is_free_shipping] eq 0"> checked="checked"</if>>
          </div>
          <p class="notic"></p>
        </dd>
      </dl>
          <dl class="row">
              <dt class="tit">
                <label>是否为实物</label>
              </dt>
              <dd class="opt">
                <div class="onoff">
                  <label for="is_real1" class="cb-enable <if condition="$goodsInfo[is_real] eq 1">selected</if>">是</label>
                  <label for="is_real0" class="cb-disable <if condition="$goodsInfo[is_real] eq 0">selected</if>">否</label>
                  <input id="is_real1" name="is_real" value="1" type="radio" <if condition="$goodsInfo[is_real] eq 1"> checked="checked"</if>>
                  <input id="is_real0" name="is_real" value="0" type="radio" <if condition="$goodsInfo[is_real] eq 0"> checked="checked"</if>>
                </div>
                <p class="notic"></p>
              </dd>
            </dl>                        
              
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">库存数量</label>
                </dt>
                <dd class="opt">                
                    <if condition="$goodsInfo[goods_id] gt 0">
                        <input type="text" value="{$goodsInfo.store_count}" class="t_mane" name="store_count" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <else />
                        <input type="text" value="{$tpshop_config[basic_default_storage]}" class="t_mane" name="store_count" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />                                         
                    </if>
                    <span class="err" id="err_store_count" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label>上架时间</label></dt>
                <dd class="opt"><input type="text" id="start_time" name="on_time" value="{:date('Y-m-d H:i:s',$goodsInfo['on_time'])}" class="input-txt">
            </dl>
            <dl class="row">
                <dt class="tit"><label>下架时间</label></dt>
                <dd class="opt"><input type="text" id="end_time" name="off_time" value="{:date('Y-m-d H:i:s',$goodsInfo['off_time'])}" class="input-txt">
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">赠送积分</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.give_integral}" name="give_integral" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_give_integral" style="color:#F00; display:none;"></span>
                </dd>
            </dl>  
            
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">兑换积分</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.exchange_integral}" name="exchange_integral" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_exchange_integral" style="color:#F00; display:none;"></span>
                </dd>
            </dl>     
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品关键词</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.keywords}" name="keywords" class="input-txt"/>
                    <span class="err" id="err_keywords" style="color:#F00; display:none;"></span>
                </dd>
            </dl>       
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品详情描述</label>
                </dt>
                <dd class="opt">                    
                    <textarea class="span12 ckeditor" id="goods_content" name="goods_content" title="">{$goodsInfo.goods_content}</textarea>
                    <span class="err" id="err_goods_content" style="color:#F00; display:none;"></span>                    
                </dd>
            </dl>                                                                                                                                           
        </div>
<!--通用信息-->
<!-- 商品相册-->        
		<div class="ncap-form-default tab_div_2" style="display:none;">
            <dl class="row">
                
                         <div class="tab-pane" id="tab_goods_images">
                            <table class="table table-bordered">
                                <tbody>
                                <tr>                                    
                                    <td>                                    
                                    <foreach name="goodsImages" item="vo" key="k" >
                                        <div style="width:100px; text-align:center; margin: 5px; display:inline-block;" class="goods_xc">
                                            <input type="hidden" value="{$vo['image_url']}" name="goods_images[]">
                                            <a onClick="" href="{$vo['image_url']}" target="_blank"><img width="100" height="100" src="{$vo['image_url']}"></a>
                                            <br>
                                            <a href="javascript:void(0)" onClick="ClearPicArr2(this,'{$vo['image_url']}')">删除</a>
                                        </div>
                                    </foreach>
                                    
                                        <div class="goods_xc" style="width:100px; text-align:center; margin: 5px; display:inline-block;">
                                            <input type="hidden" name="goods_images[]" value="" />
                                            <a href="javascript:void(0);" onClick="GetUploadify(10,'','goods','call_back2');"><img src="/public/images/add-button.jpg" width="100" height="100" /></a>
                                            <br/>
                                            <a href="javascript:void(0)">&nbsp;&nbsp;</a>
                                        </div>                                        
                                    </td>
                                </tr>                                              
                                </tbody>
                            </table>
                        </div>
                
            </dl>             
        </div>   
<!-- 商品相册-->
<!-- 商品模型-->
		<div class="ncap-form-default tab_div_3" style="display:none;">
            <dl class="row">

                        <div class="tab-pane" id="tab_goods_spec">
                            <table class="table table-bordered" id="goods_spec_table">                                
                                <tr>
                                    <td>商品模型:</td>
                                    <td>                                        
                                      <select name="goods_type" id="spec_type" class="form-control" style="width:250px;">
                                        <option value="0">选择商品模型</option>
                                        <foreach name="goodsType" item="vo" key="k" >
                                            <option value="{$vo.id}"<if condition="$goodsInfo[goods_type] eq $vo[id]"> selected="selected" </if> >{$vo.name}</option>
                                        </foreach>                                        
                                      </select>
                                    </td>
                                </tr>                            
                            </table>
                            <div class="row">
                            	<!-- ajax 返回规格-->
                            	<div id="ajax_spec_data" class="col-xs-8" ></div>
                            	<div id="" class="col-xs-4" >
                            	    <table class="table table-bordered" id="goods_attr_table">                                
		                                <tr>
		                                    <td><b>商品属性</b>：</td>
		                                </tr>                                
		                            </table>
                            	</div>
                            </div>
                        </div>
                
            </dl>             
        </div>   
<!-- 商品模型-->         
<!-- 商品物流-->
		<div class="ncap-form-default tab_div_4" style="display:none;">
            <dl class="row">
                        <div class="tab-pane" id="tab_goods_shipping">
                            <h4><b>物流配送：</b><input type="checkbox" onClick="choosebox(this)">全选</h4>
                            <table class="table table-bordered table-striped dataTable" id="goods_shipping_table">
                                <foreach name="plugin_shipping" item="shipping" key="kk">
                                    <tr>
                                        <td class="title left" style="padding-right:50px;">
                                            <b>{$shipping[name]}：</b>
                                            <label class="right"><input type="checkbox" value="1" cka="mod-{$kk}">全选</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="group-list">
                                                <foreach name="shipping_area" item="vv">
                                                    <if condition="$vv[shipping_code] eq $shipping[code]">
                                                        <li><label><input type="checkbox" name="shipping_area_ids[]" value="{$vv.shipping_area_id}" <if condition="in_array($vv['shipping_area_id'],$goods_shipping_area_ids)">checked='checked='</if> ck="mod-{$kk}">{$vv.shipping_area_name}</label></li>
                                                    </if>
                                                </foreach>
                                                <div class="clear-both"></div>
                                            </ul>
                                        </td>
                                    </tr>
                                </foreach>
                            </table>
                        </div>                
            </dl>             
        </div>   
<!-- 商品物流-->

		<div class="ncap-form-default">        
            <div class="bot">            
                <input type="hidden" name="goods_id" value="{$goodsInfo.goods_id}">
                <input type="hidden" name="__token__" value="{$Request.token}" />
                <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onClick="ajax_submit_form('addEditGoodsForm','{:U('Goods/addEditGoods?is_ajax=1')}');">确认提交</a>
            </div>
        </div> 
     </form>
    <!--表单数据-->
</div>
<div id="goTop"> <a href="JavaScript:void(0);" id="btntop"><i class="fa fa-angle-up"></i></a><a href="JavaScript:void(0);" id="btnbottom"><i class="fa fa-angle-down"></i></a></div>
<script>

    // 物流设置相 关
     $(document).ready(function(){
        $(":checkbox[cka]").click(function(){
            var $cks = $(":checkbox[ck='"+$(this).attr("cka")+"']");
            if($(this).is(':checked')){
                $cks.each(function(){$(this).prop("checked",true);});
            }else{
                $cks.each(function(){$(this).removeAttr('checked');});
            }
        });
    });
    // 物流设置相 关
    function choosebox(o){
        var vt = $(o).is(':checked');
        if(vt){
            $('input[type=checkbox]').prop('checked',vt);
        }else{
            $('input[type=checkbox]').removeAttr('checked');
        }
    }
    /*
     * 以下是图片上传方法
     */
    // 上传商品图片成功回调函数
    function call_back(fileurl_tmp){
        $("#original_img").val(fileurl_tmp);
    	$("#original_img2").attr('href', fileurl_tmp);
    }
 
    // 上传商品相册回调函数
    function call_back2(paths){
        
        var  last_div = $(".goods_xc:last").prop("outerHTML");	
        for (i=0;i<paths.length ;i++ )
        {                    
            $(".goods_xc:eq(0)").before(last_div);	// 插入一个 新图片
                $(".goods_xc:eq(0)").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
            $(".goods_xc:eq(0)").find('img').attr('src',paths[i]);// 修改他的图片路径
                $(".goods_xc:eq(0)").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('删除');
            $(".goods_xc:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        } 			   
    }
    /*
     * 上传之后删除组图input     
     * @access   public
     * @val      string  删除的图片input
     */
    function ClearPicArr2(obj,path)
    {
    	$.ajax({
                    type:'GET',
                    url:"{:U('Admin/Uploadify/delupload')}",
                    data:{action:"del", filename:path},
                    success:function(){
                           $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片				 
                    }
		});
		// 删除数据库记录
    	$.ajax({
                    type:'GET',
                    url:"{:U('Admin/Goods/del_goods_images')}",
                    data:{filename:path},
                    success:function(){
                          //		 
                    }
		});		
    }
 


/** 以下 商品属性相关 js*/

// 属性输入框的加减事件
function addAttr(a)
{
	var attr = $(a).parent().parent().prop("outerHTML");	
	attr = attr.replace('addAttr','delAttr').replace('+','-');	
	$(a).parent().parent().after(attr);
}
// 属性输入框的加减事件
function delAttr(a)
{
   $(a).parent().parent().remove();
}
 
var color
var spec
var datas
/** 以下 商品规格相关 js*/
$(document).ready(function(){	
    // 商品模型切换时 ajax 调用  返回不同的属性输入框
    $("#spec_type").change(function(){        
        var goods_id = '{$goodsInfo.goods_id}';
        var spec_type = $(this).val();
            $.ajax({
                    type:'GET',
                    data:{goods_id:goods_id,spec_type:spec_type}, 
                    url:"{:U('admin/Goods/ajaxGetSpecSelect')}",
                    success:function(data){                            
                           $("#ajax_spec_data").html('')
                           $("#ajax_spec_data").append(data);
			         ajaxGetSpecInput();	// 触发完  马上触发 规格输入框
                        if(color||spec){
                          var color_leng=$('[data-spec_id="2"]').size()-1;
                          var arr=[];
                          var i=0;
                           $('[data-spec_id="2"]').each(function(k,v){
                                arr[k] = $(this);
                               var val=$.trim($(this).text())+',';
                               var specid=$(this).attr('data-item_id');
                               $(this).attr('data',val);
                               if(spec.indexOf(val)>-1){
                                    i++;
                                    setTimeout(function(){
                                        arr[k].trigger('click');
                                    },200*i) 
                               }

                               if(k==color_leng){
                                  setTimeout(function(){
                                     $('[data-spec_id="3"]').each(function(k,v){
                                        arr[k] = $(this);
                                         var val=$.trim($(this).text())+',';
                                         var colorid=$(this).attr('data-item_id');
                                         $(this).attr('data',val);
                                         if(color.indexOf(val)>-1){
                                            i++;
                                            console.log(val);
                                            setTimeout(function(){
                                                arr[k].trigger('click');
                                            },200*i) 
                                         }
                                     })
                                  },1000) 
                               }
                           })
                           
                          setTimeout(function(){
                                $('[name="attr_1[]"]').val('广州');
                                $('[name="attr_2[]"]').val(datas[0].lining);
                               for(var i=0;i<datas.length;i++){
                                    var colorname=datas[i].color_name;
                                    var specname=datas[i].spec_name;
                                    var colork=$('[data="'+colorname+',"]').attr('data-item_id');
                                    var speck=$('[data="'+specname+',"]').attr('data-item_id');
            
                                    $('[name="item['+speck+'_'+colork+'][price]"]').val(datas[i].std_unit_price);
                                    $('[name="item['+speck+'_'+colork+'][store_count]"]').val(datas[i].num);
                                    $('[name="item['+speck+'_'+colork+'][sku]"]').val(datas[i].prod_num);

                               }
                            },3000)
                        }
                    }
            });           
            //商品类型切换时 ajax 调用  返回不同的属性输入框     
            $.ajax({
                 type:'GET',
                 data:{goods_id:goods_id,type_id:spec_type}, 
                 url:"/index.php/admin/Goods/ajaxGetAttrInput",
                 success:function(data){                            
                         $("#goods_attr_table tr:gt(0)").remove()
                         $("#goods_attr_table").append(data);
                                
                 }        
           });
    });
	// 触发商品规格
	$("#spec_type").trigger('change'); 
	
    $("input[name='exchange_integral']").blur(function(){
        var shop_price = parseInt($("input[name='shop_price']").val());
        var exchange_integral = parseInt($(this).val());
        if (shop_price * 100 < exchange_integral) {
        	
        }
    });
});

/** 以下是编辑时默认选中某个商品分类*/
$(document).ready(function(){

	<if condition="$level_cat['2'] gt 0">
		 // 商品分类第二个下拉菜单
		 get_category('{$level_cat[1]}','cat_id_2','{$level_cat[2]}');	
	</if>
	<if condition="$level_cat['3'] gt 0">
		// 商品分类第二个下拉菜单
		 get_category('{$level_cat[2]}','cat_id_3','{$level_cat[3]}');	 
	</if>

    //  扩展分类
	<if condition="$level_cat2['2'] gt 0">
		 // 商品分类第二个下拉菜单
		 get_category_admin('{$level_cat2[1]}','extend_cat_id_2','{$level_cat2[2]}');
	</if>
	<if condition="$level_cat2['3'] gt 0">
		// 商品分类第二个下拉菜单
		 get_category_admin('{$level_cat2[2]}','extend_cat_id_3','{$level_cat2[3]}');
	</if>

});
 
 
    $(document).ready(function(){
     
        //插件切换列表
        $('.tab-base').find('.tab').click(function(){
            $('.tab-base').find('.tab').each(function(){
                $(this).removeClass('current');
            });
            $(this).addClass('current');
			var tab_index = $(this).data('index');
			$(".tab_div_1, .tab_div_2, .tab_div_3, .tab_div_4").hide();
			$(".tab_div_"+tab_index).show();
		});		
            
    });

    //时间控件
    $(document).ready(function () {
        $('#start_time').layDate();
        $('#end_time').layDate();
    })

//自动填写
$('#one_btn').click(function(){
    var goods_sn=$('#goods_sn').val()
    if(goods_sn=="") {
        alert('请填写商品货号');
        return false;
    }

    $.post('{:U("Goods/get_goodsinfo")}',{goods_sn:goods_sn},function(res){
        var obj=$.parseJSON(res);
        datas=obj.data;
        color=obj.color;
        spec=obj.spec;
        $('[name="goods_name"]').val('第七感觉'+datas[0].prod_name.replace(/\d+/g,''));
        $('[name="spu"]').val(datas[0].prod_cls_num);
        $('[name="sku"]').val(datas[0].prod_cls_num);
        $('[name="shop_price"],[name="market_price"]').val(Math.floor(datas[0].std_unit_price*100)/100);
        $('[name="cost_price"]').val(Math.floor(datas[0].pu_unit_price*100)/100);
        $('.onoff').children('label:first').attr('class','cb-enable selected');
        $('[name="store_count"]').val(obj.total_num);
        $('[name="give_integral"]').val(parseInt(datas[0].std_unit_price));
        $('[name="store_count"]').val(obj.total_num);
        

    })
})
</script>		
</body>
</html>